import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.HexUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.jeecg.common.lineparser.Line;
import org.jeecg.common.lineparser.LineParser;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;

public class ReadBigFile {

    public static void main(String[] args) {
        Path path = Paths.get("D:\\pc_workspace\\2.h264str");
        Charset cs = StandardCharsets.UTF_8;
        LineParser parser = new LineParser(Integer.MAX_VALUE, 0);

        try {
            parser.forEach(path, cs, new Consumer<Line>() {
                @Override
                public void accept(Line line) {
                    System.out.println(",offset=" + line.getOffset() + ",len=" + line.getLength());
                    FileUtil.appendUtf8Lines(Arrays.asList(line.getContent()), "D:\\pc_workspace\\3c.h264");
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
